const CDN_URL = import.meta.env.LM_CDN_URL
const STATIC_URL = import.meta.env.LM_STATIC_URL
/** 添加cdn域名前缀 */
export const _cdn = (url = '', cdnurl = '') => {
	if (!url) return '';
	if (url.indexOf('http') === 0) {
		return url;
	}
	if (cdnurl === '') {
		cdnurl = CDN_URL;
	}
	return cdnurl + url;
};
/**  静态资源地址 */
export const _static = (url = '', staticurl = '') => {
  if (staticurl === '') {
    staticurl = STATIC_URL;
  }
  if (staticurl !== 'local') {
    url = _cdn(url, staticurl);
  }
  return url;
};
/** css背景图片地址 */
export const _css = (url = '', staticurl = '') => {
  if (staticurl === '') {
    staticurl = STATIC_URL;
  }
  if (staticurl !== 'local') {
    url = _cdn(url, staticurl);
  }
  // #ifdef APP-PLUS
  if (staticurl === 'local') {
    url = plus.io.convertLocalFileSystemURL(url);
  }
  // #endif
  // #ifdef H5
  if (staticurl === 'local') {
    url = `/h5${url}`;
  }
  // #endif
  return `url(${url})`;
}